package com.example.inventorywarningdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.inventorywarningdemo.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * @author Survive
 * @date 2025/3/11
 * @description TODO
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order>{
    // 获取指定店铺当日营业额
    @Select("SELECT COALESCE(SUM(o.amount), 0) FROM mt_order o " +
            "WHERE o.store_id = #{storeId} ")
/*            "WHERE o.shopId = :shopId " +
            "AND o.createTime BETWEEN :start AND :end")*/
    BigDecimal getDailyRevenueByShop(Long storeId);
}